package com.sqmf.service.impl;

import com.sqmf.mapper.UserMapper;
import com.sqmf.pojo.User;
import com.sqmf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> getAll() {
        return userMapper.getAll();
    }

    @Override
    public User findUserInfoById(Integer id) throws Exception {
        if (StringUtils.isEmpty(id)) {
            throw new Exception("参数缺失");
        }
        return userMapper.findUserInfoById(id);
    }

    @Override
    public Integer updateUser(User user) {

        return userMapper.updateUser(user);
    }

    @Override
    public Integer addUser(User user) {
        return null;
    }

}
